package com.ybf.api.builder;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
public class GenerateFile {
    private String tableName;
    private String entityName;
    private List<FileTemplateInfo> fileTemplateInfoList;

    public GenerateFile(String tableName, String entityName) {
        this.tableName = tableName;
        this.entityName = entityName;
        this.fileTemplateInfoList = new ArrayList<>();
        this.fileTemplateInfoList.add(new FileTemplateInfo(
                "entity.java.vm",
                "entity/" + entityName + ".java")
        );
        this.fileTemplateInfoList.add(new FileTemplateInfo(
                "controller.java.vm",
                "controller/" + entityName + "Controller.java")
        );
        this.fileTemplateInfoList.add(new FileTemplateInfo(
                "mapper.java.vm",
                "mapper/" + entityName + "Mapper.java")
        );
        this.fileTemplateInfoList.add(new FileTemplateInfo(
                "provider.java.vm",
                "mapper/provider/" + entityName + "Provider.java")
        );
        this.fileTemplateInfoList.add(new FileTemplateInfo(
                "service.java.vm",
                "service/" + entityName + "Service.java")
        );
        this.fileTemplateInfoList.add(new FileTemplateInfo(
                "serviceImpl.java.vm",
                "service/impl/" + entityName + "Impl.java")
        );
    }
}
